/*
 * Copyright (c) 2022 Huawei Technologies Co.,Ltd.
 *
 * openGauss is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *
 * http://license.coscl.org.cn/MulanPSL2
 *
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FITFOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 * -------------------------------------------------------------------------
 *
 * WsConnectType.java
 *
 * IDENTIFICATION
 * base-ops/src/main/java/org/opengauss/admin/plugin/enums/ops/WsConnectType.java
 *
 * -------------------------------------------------------------------------
 */

package org.opengauss.admin.plugin.enums.ops;

import lombok.AllArgsConstructor;

/**
 * websocket connection type
 *
 * @author lhf
 * @date 2022/8/6 18:05
 **/
@AllArgsConstructor
public enum WsConnectType {
    /**
     * Downloading the Installation Package
     */
    DOWNLOAD_INSTALL_PACKAGE,
    /**
     * ssh Interaction
     */
    SSH,
    /**
     * Execute a command
     */
    COMMAND_EXEC;

    public static WsConnectType nameOf(String name) {
        WsConnectType[] enumConstants = WsConnectType.class.getEnumConstants();
        for (WsConnectType enumConstant : enumConstants) {
            if (enumConstant.name().equalsIgnoreCase(name)){
                return enumConstant;
            }
        }
        return null;
    }
}
